<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 数组去重
    let arr =  [12, 4, 4, 5, 6, 8, 19, 5,28, 35, 24, 4, 2, 5];

    console.log(getNewArray(arr));

    function getNewArray(arr){
      let newArr = [arr[0]];
      for(let i = 1; i < arr.length; i++){
        if(newArr.includes(arr[i]) === false ){
          newArr.push(arr[i]);
        }
      }
      return newArr;
    }

    













  </script>
</body>
</html>